package com.gemalto.Kryptik.Algo;


import com.gemalto.Kryptik.Algo.*;
import com.gemalto.Kryptik.Gui.*;

/**
 * 
 * @author  STURC
 * @version 
 */
public abstract class KeyedAlgo extends AbstractAlgo {

	 	/**
		 * KeyedAlgo has a key :-)  
		 */
		String key;
		int keyLength;
		
		/**
		 * This method set current value of key.
		 */
		public void setKey(String key){
				this.key = key;
				if (panel!=null) panel.update();
		}

		/**
		 * Generic method for checking of validity of the key.
		 * Childs should override this method to test if key
		 * is instance of real key class.
		 */
		protected boolean hasValidKey(){
				if ( getKey() == null )
					return false;
				else  return true;
		}

		/**
		 * returns the key. User has to cast Object to real key class.
		 */
		public String getKey(){
				return this.key;
		}


		public int getKeyLength(){
			return this.keyLength;
		}

}
// vim:tabstop=4:nowrap
